<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<div class="span8 offset2">
    <form class="form-horizontal well" method="POST" action="MainServlet?action=trip.save">
        <fieldset>
            <legend>New trip</legend>
            <div class="hidden">
                <input type="hidden" name="id" value="0">
            </div>
            <div class="control-group">
                <label class="control-label" for="route">Route:</label>
                <div class="controls">
                    <select class="myinput" id="route" name="route">
                        <option value="0" selected="true"></option>
                        <c:forEach var="route" items="${routeList}">
                            <option value="<c:out value="${route.getId()}" />"><c:out value="${route.getRouteName()}" /></option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="tripState">Trip state:</label>
                <div class="controls">
                    <select class="myinput" id="tripState" name="tripState">
                        <option value="0" selected="true"></option>
                        <c:forEach var="tripState" items="${tripStateList}">
                            <option value="<c:out value="${tripState.toString()}" />"><c:out value="${tripState.toString()}" /></option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="tripDate">Trip date:</label>
                <div class="controls">
                    <input class="myinput" type="text" id="tripDate" name="tripDate" value="">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="bus">Bus:</label>
                <div class="controls">
                    <select class="myinput" id="bus" name="bus">
                        <option value="0" selected="true"></option>
                        <c:forEach var="bus" items="${busList}">
                            <option value="<c:out value="${bus.getId()}" />"><c:out value="${bus.getStateNumber()}" /></option>
                        </c:forEach>
                    </select>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="driverName">Driver name:</label>
                <div class="controls">
                    <input class="myinput" type="text" id="driverName" name="driverName" value="">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="conductorName">Conductor name:</label>
                <div class="controls">
                    <input class="myinput" type="text" id="conductorName" name="conductorName" value="">
                </div>
            </div>
            <div class="form-actions">
                <input type="submit" class="btn btn-primary" name="saveButton" value="Create new trip">
                <button class="btn" id="cancelButton" name="cancelButton" data-button-to-click="cancelButtonOutOfForm">Cancel</button>
            </div>
        </fieldset>
    </form>
    <button class="btn" id="cancelButtonOutOfForm" data-link="trip-list" style="display: none; visibility: hidden; height: 0px; width: 0px;">Cancel</button>
</div>
